package com.dr.Enum;

/**
 * Created by tugou on 2017/4/24.
 */
public enum ExcepEnum {

    /**
     * 无异常
     */
    OK("OK",1000),
    INSERTDATAEMPTY("数据库插入失败",2000),
    QUERYRESULTISEMPTY("数据查询结果为空",2001);


    private int index;
    private String name;

    ExcepEnum(String name,int index){
        this.index = index;
        this.name = name;
    }


    public int getIndex() {
        return index;
    }


    public void setIndex(int index) {
        this.index = index;
    }


    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }


    public static String getName(int index){
        for (ExcepEnum e : ExcepEnum.values()) {
            if(e.index == index){
                return e.name;
            }
        }
        return null;
    }


}
